#include<iostream>
#include<vector>
#include<queue>
#include<cstring>
#include<cmath>
#include<map>
#include<set>
#include<cstdio>
#include<unordered_map>
#include<algorithm>
#define debug(a) cout<<#a<<"="<<a<<endl;
using namespace std;
const int maxn=2e5+1000;
typedef long long LL;
typedef tuple<int,int,int> P;
inline LL read(){LL x=0,f=1;char ch=getchar();	while (!isdigit(ch)){if (ch=='-') f=-1;ch=getchar();}while (isdigit(ch)){x=x*10+ch-48;ch=getchar();}
return x*f;}
unordered_map<LL,LL>map1;
LL a[maxn];
int main(void){
   	cin.tie(0);std::ios::sync_with_stdio(false);
    LL n;cin>>n;
    for(int i=1;i<=n;i++) cin>>a[i],map1[a[i]]++;
    LL ans=1e18,num=-1;
    for(auto i:map1){
        if(ans>n-i.second){
            ans=n-i.second;
            num=i.first;
        }
    }
    LL pos=-1;
    for(int i=1;i<=n;i++){
        if(a[i]==num) {pos=i;break;}
    }
    //debug(pos);
    vector<P>v;
   	int l=pos,r=pos;
   	while(l-1>=1){
        if(a[l]==num&&a[l-1]!=num){
            if(a[l]>a[l-1]){
                v.push_back(make_tuple(1,l-1,l));
            }
            else{
                v.push_back(make_tuple(2,l-1,l));
            }
        }
        l--;
        a[l]=num;
   	}
   	while(r+1<=n){
        if(a[r]==num&&a[r+1]!=num){
            if(a[r]>a[r+1]){
                v.push_back(make_tuple(1,r+1,r));
            }
            else if(a[r]<a[r+1]){
                v.push_back(make_tuple(2,r+1,r));
            }
        }
        r++;
        a[r]=num;
   	}
   	cout<<v.size()<<endl;
   	for(auto i:v){
        cout<<get<0>(i)<<" "<<get<1>(i)<<" "<<get<2>(i)<<endl;
   	}
   	return 0;
}
